<html>
<body bgcolor="#ffffff">

<h1>Test Zql</h1>

Some queries follow:
<ul>
<li>Copy them in a "test.in" file</li>
<li>Run <code>java Zql.ZqlParser test.in</code></li>
<li>You can even redirect the command output to a "test.out" file, then
parse it using <code>java Zql.ZqlParser test.out</code></li>
</ul>
<p>

<pre>
SELECT * FROM TableName;
SELECT FirstName, LastName, Address, City, State FROM EmployeeAddressTable;
SELECT EMPLOYEEIDNO FROM EMPLOYEESTATISTICSTABLE WHERE SALARY &gt;= 50000;
SELECT EMPLOYEEIDNO FROM EMPLOYEESTATISTICSTABLE WHERE POSITION = 'Manager';
SELECT EMPLOYEEIDNO FROM EMPLOYEESTATISTICSTABLE
WHERE SALARY &gt; 40000 AND POSITION = 'Staff';
SELECT EMPLOYEEIDNO FROM EMPLOYEESTATISTICSTABLE
WHERE SALARY &lt; 40000 OR BENEFITS &lt; 10000;
SELECT EMPLOYEEIDNO FROM EMPLOYEESTATISTICSTABLE
WHERE POSITION = 'Manager' AND SALARY &gt; 60000 OR BENEFITS &gt; 12000;
SELECT EMPLOYEEIDNO FROM EMPLOYEESTATISTICSTABLE
WHERE POSITION = 'Manager' AND (SALARY &gt; 50000 OR BENEFIT &gt; 10000);
SELECT EMPLOYEEIDNO FROM EMPLOYEESTATISTICSTABLE
WHERE POSITION IN ('Manager', 'Staff');
SELECT EMPLOYEEIDNO FROM EMPLOYEESTATISTICSTABLE
WHERE SALARY BETWEEN 30000 AND 50000;
SELECT EMPLOYEEIDNO FROM EMPLOYEESTATISTICSTABLE
WHERE SALARY NOT BETWEEN 30000 AND 50000;
SELECT EMPLOYEEIDNO FROM EMPLOYEEADDRESSTABLE WHERE LASTNAME LIKE 'L%';
SELECT OWNERLASTNAME, OWNERFIRSTNAME FROM ANTIQUEOWNERS, ANTIQUES
WHERE BUYERID = OWNERID AND ITEM = 'Chair';
SELECT ANTIQUEOWNERS.OWNERLASTNAME, ANTIQUEOWNERS.OWNERFIRSTNAME
FROM ANTIQUEOWNERS, ANTIQUES
WHERE ANTIQUES.BUYERID = ANTIQUEOWNERS.OWNERID AND ANTIQUES.ITEM = 'Chair';
SELECT DISTINCT SELLERID, OWNERLASTNAME, OWNERFIRSTNAME
FROM ANTIQUES, ANTIQUEOWNERS
WHERE SELLERID = OWNERID
ORDER BY OWNERLASTNAME, OWNERFIRSTNAME, OWNERID;
SELECT OWN.OWNERLASTNAME Last Name, ORD.ITEMDESIRED Item Ordered
FROM ORDERS ORD, ANTIQUEOWNERS OWN
WHERE ORD.OWNERID = OWN.OWNERID
AND ORD.ITEMDESIRED IN (SELECT ITEM FROM ANTIQUES);
SELECT SUM(SALARY), AVG(SALARY) FROM EMPLOYEESTATISTICSTABLE;
SELECT MIN(BENEFITS) FROM EMPLOYEESTATISTICSTABLE WHERE POSITION = 'Manager';
SELECT COUNT(*) FROM EMPLOYEESTATISTICSTABLE WHERE POSITION = 'Staff';
SELECT SELLERID FROM ANTIQUES, ANTVIEW WHERE ITEMDESIRED = ITEM;
INSERT INTO ANTIQUES VALUES (21, 01, 'Ottoman', 200.00);
INSERT INTO ANTIQUES (BUYERID, SELLERID, ITEM) VALUES (01, 21, 'Ottoman');
DELETE FROM ANTIQUES WHERE ITEM = 'Ottoman';
DELETE FROM ANTIQUES WHERE ITEM = 'Ottoman' AND BUYERID = 01 AND SELLERID = 21;
UPDATE ANTIQUES SET PRICE = 500.00 WHERE ITEM = 'Chair';
SELECT BUYERID, MAX(PRICE) FROM ANTIQUES GROUP BY BUYERID;
SELECT BUYERID, MAX(PRICE) FROM ANTIQUES GROUP BY BUYERID HAVING PRICE &gt; 1000;
SELECT OWNERID FROM ANTIQUES
WHERE PRICE &gt; (SELECT AVG(PRICE) + 100 FROM ANTIQUES);
SELECT OWNERLASTNAME FROM ANTIQUEOWNERS
WHERE OWNERID = (SELECT DISTINCT BUYERID FROM ANTIQUES);
UPDATE ANTIQUEOWNERS SET OWNERFIRSTNAME = 'John'
WHERE OWNERID = (SELECT BUYERID FROM ANTIQUES WHERE ITEM = 'Bookcase');
SELECT OWNERFIRSTNAME, OWNERLASTNAME FROM ANTIQUEOWNERS
WHERE EXISTS (SELECT * FROM ANTIQUES WHERE ITEM = 'Chair');
SELECT BUYERID, ITEM FROM ANTIQUES
WHERE PRICE &gt;= ALL (SELECT PRICE FROM ANTIQUES);
SELECT BUYERID FROM ANTIQUEOWNERS UNION SELECT OWNERID FROM ORDERS;
SELECT OWNERID, 'is in both Orders & Antiques' FROM ORDERS, ANTIQUES
WHERE OWNERID = BUYERID
UNION
SELECT BUYERID, 'is in Antiques only' FROM ANTIQUES
WHERE BUYERID NOT IN (SELECT OWNERID FROM ORDERS);
EXIT;
</pre>

</body>
</html>
